package com.example.user.controller;

import com.example.user.entity.Users;
import com.example.user.mapper.ESUserMapper;
import com.example.user.service.UsersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController("/users")
@ResponseBody
public class UserController {

    @Autowired
    private UsersService usersService;

    @Autowired
    private ESUserMapper esUserMapper;

    @RequestMapping("/test")
    public String TestUser(@RequestParam("id") Long id) {

        Users user = usersService.getById(id);
        System.out.print(user);
        return "test";
    }

    @RequestMapping("/insertES")
    public Object insertES(@RequestBody Users users) {
        Users save = esUserMapper.save(users);
        return esUserMapper.findById("D_cJapQB1x-HlO5k1sDf");
//        return save;
//        return "1";
    }



}